package models

//总场景
type Scene struct {
	BaseModel
	SceneName string `gorm:"type:varchar(255);not null;comment:场景名称" json:"scene_name"` //桥梁、隧道、特种设备、加油站、高速运营公路
	//英文名
	SceneEnName string `gorm:"type:varchar(255);not null;comment:场景英文名" json:"scene_en_name"`
}

// TableName 指定表名
func (Scene) TableName() string {
	return "scene"
}

//一级场景
type FirstScene struct {
	BaseModel
	FirstSceneName string `gorm:"type:varchar(255);not null;comment:一级场景名称" json:"first_scene_name"`
	SceneID        int    `gorm:"type:int;not null;comment:场景ID" json:"scene_id"`
	//关联表
	Scene Scene `gorm:"foreignKey:SceneID"`
}

// TableName 指定表名
func (FirstScene) TableName() string {
	return "first_scene"
}

//二级场景
type SecondScene struct {
	BaseModel
	SecondSceneName string `gorm:"type:varchar(255);not null;comment:二级场景名称" json:"second_scene_name"`
	FirstSceneID    int    `gorm:"type:int;not null;comment:一级场景ID" json:"first_scene_id"`
	//关联表
	FirstScene FirstScene `gorm:"foreignKey:FirstSceneID"`
}

// TableName 指定表名
func (SecondScene) TableName() string {
	return "second_scene"
}

//三级场景
type ThirdScene struct {
	BaseModel
	ThirdSceneName string `gorm:"type:varchar(255);not null;comment:三级场景名称" json:"third_scene_name"`
	SecondSceneID  int    `gorm:"type:int;not null;comment:二级场景ID" json:"second_scene_id"`
	//关联表
	SecondScene SecondScene `gorm:"foreignKey:SecondSceneID"`
	//正确示例图
	CorrectExampleImage string `gorm:"type:varchar(255);not null;comment:正确示例图" json:"correct_example_image"`
	//错误示例图
	WrongExampleImage string `gorm:"type:varchar(255);not null;comment:错误示例图" json:"wrong_example_image"`
}

// TableName 指定表名
func (ThirdScene) TableName() string {
	return "third_scene"
}

//识别记录
type RecognitionRecord struct {
	BaseModel
	//原图地址
	OriginalImageUrl string `gorm:"type:text;not null;comment:原图地址" json:"original_image_url"`
	//识别结果图地址
	RecognitionImageUrl string `gorm:"type:text;not null;comment:识别结果图地址" json:"recognition_image_url"`
	//用户ID
	UserID int `gorm:"type:int;not null;comment:用户ID" json:"user_id"`

	//title
	Title string `gorm:"type:varchar(255);not null;comment:标题" json:"title"`
	//描述
	Description string `gorm:"type:text;not null;comment:描述" json:"description"`
	//标签
	Labels string `gorm:"type:varchar(255);not null;comment:标签" json:"labels"`
	//主标签
	TagType string `gorm:"type:varchar(255);not null;comment:标签类型" json:"tag_type"`
	//详情页的二级场景
	SecondScene string `gorm:"type:varchar(1000);comment:详情页的二级场景" json:"second_scene"`
	//详情页的三级场景
	ThirdScene string `gorm:"type:varchar(1000);comment:详情页的三级场景" json:"third_scene"`
}

// TableName 指定表名
func (RecognitionRecord) TableName() string {
	return "recognition_record"
}

//识别记录对应的二级场景表
type RecognitionRecordSecondScene struct {
	BaseModel
	RecognitionRecordID int `gorm:"type:int;not null;comment:识别记录ID" json:"recognition_record_id"`
	SecondSceneID       int `gorm:"type:int;not null;comment:二级场景ID" json:"second_scene_id"`
	//关联表
	SecondScene SecondScene `gorm:"foreignKey:SecondSceneID"`
}

// TableName 指定表名
func (RecognitionRecordSecondScene) TableName() string {
	return "recognition_record_second_scene"
}
